﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LowLevelGraphics.Filter
{
    /// <summary>
    /// 
    /// </summary>
    public enum FILTER2_MODE
    {
        /// <summary>
        /// 
        /// </summary>
        FULL,
        /// <summary>
        /// 
        /// </summary>
        VALID,
        /// <summary>
        /// 
        /// </summary>
        SAME
    }

    /// <summary>
    ///filter2 - 2-D digital filter
    ///Syntax
    ///
    ///Y = filter2(h,X)
    ///Y = filter2(h,X,shape)
    ///Description
    ///
    ///Y = filter2(h,X) filters the data in X with the two-dimensional FIR filter in the matrix h. It computes the result, Y, using two-dimensional correlation, and returns the central part of the correlation that is the same size as X.
    ///
    ///Y = filter2(h,X,shape) returns the part of Y specified by the shape parameter. shape is a string with one of these values:
    ///
    ///'full'
    ///
    ///
    ///Returns the full two-dimensional correlation. In this case, Y is larger than X.
    ///
    ///'same'
    ///
    ///
    ///(default) Returns the central part of the correlation. In this case, Y is the same size as X.
    ///
    ///'valid'
    ///
    ///
    ///Returns only those parts of the correlation that are computed without zero-padded edges. In this case, Y is smaller than X.
    /// </summary>
    /// <remarks>Two-dimensional correlation is equivalent to two-dimensional convolution with the filter matrix rotated 180 degrees. See the Algorithm section for more information about how filter2 performs linear filtering.</remarks>
    public class Filter2 : BaseImageFilter
    {
        protected FILTER2_MODE m_MODE = FILTER2_MODE.FULL;

        /// <summary>
        /// Initializes a new instance of the <see cref="Filter2"/> class.
        /// </summary>
        public Filter2()
        {

        }

        /// <summary>
        /// Gets or sets the mode.
        /// </summary>
        /// <value>The mode.</value>
        public FILTER2_MODE Mode
        {
            get { return m_MODE; }
            set { m_MODE = value; }
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="Filter2"/> class.
        /// </summary>
        /// <param name="_filter2">The _filter2.</param>
        internal Filter2(Filter2 _filter2)
        {
        }

        /// <summary>
        /// Execute this Filter
        /// A Debug Statement is written if a concrete Filter is called
        /// </summary>
        /// <param name="_bitmap"></param>
        /// <returns></returns>
        public override UnsafeBitmap Execute(UnsafeBitmap _bitmap)
        {
            return base.Execute(_bitmap);
        }

        /// <summary>
        /// This is used to clone a filter, each filter must implement it's own clone functionality
        /// </summary>
        /// <returns></returns>
        public override object Clone()
        {
            return new Filter2(this);
        }
    }
}
